****************************************************************************
* File-Nale: 		pilot.do
* Date:		 04/30/2018
* Author: 		Fred Batista
* Purpose: 		Analyses of pilot study
* Data used: 		pilot.dta
* Data Output:	Journal of Politics� paper	*/
****************************************************************************

* q5 - age
* q6 - gender
* q7 - education
* q8, q8b, q8c, q8d - partisanship
* q9a_1 to q9a_8 - threat thermometers
* q9b_1 to q9b_8 - neutral thermometers
* q9c_1 to q9c_8 lift thermometers
* q9d - threat question
* q37 - lift question
* q10 - mediation
* q11a2 - senateterm (49%)
* q11b2 - billrights (83%)
* q11c2 - boehner (61%)
* q11d2 - cameron (48%)
* q11e2 - housemajo (70%)
* q11f2 - womencourt (38%)

*** knowledge itens

gen senateterm = q11a2

gen billrights = q11b2

gen boehner = q11c2

gen cameron = q11d2

gen housemajo = q11e2

gen womencourt = q11f2

pwcorr senateterm billrights boehner cameron housemajo womencourt, sig

factor senateterm billrights boehner cameron housemajo womencourt, ml factor(1)

gen knowledge = (senateterm + billrights + boehner + cameron + housemajo + womencourt)*100/6

gen knowledge2 = (senateterm + billrights + boehner + cameron + housemajo)*20

gen knowledge3 = (senateterm + billrights + boehner + cameron)*25



*** experimental condition

gen therm_threat = 0

replace therm_threat = 1 if q9a_1!=.

gen therm_neutral = 0

replace therm_neutral = 1 if q9b_1!=.

gen therm_lift = 0

replace therm_lift = 1 if q9c_1!=.

gen quest_threat = 0

replace quest_threat = 1 if q9d!=.

gen quest_lift= 0

replace quest_lift = 1 if q37!=.


gen condition = 0

replace condition = 1 if therm_threat==1

replace condition = 2 if therm_neutral==1

replace condition = 3 if therm_lift==1

replace condition = 4 if quest_lift==1

replace condition = 5 if quest_threat==1

label define conditionl 0 "contro" 1 "them_threat" 2 "therm_neutral" 3 "therm_lift" 4 "quest_lift" 5 "quest_threat"

label values condition conditionl


*** mediation question

gen stereo = q10 - 1

*** gender

gen man = 2 - q6

*** education

gen education = q7 - 1

** age

gen age = q5 +18

** partisanship (from democrat to republican)

gen partisanship = .

replace partisanship = 0 if q8b==1

replace partisanship = 1 if q8b==2

replace partisanship = 2 if q8d ==2

replace partisanship = 3 if q8 >2

replace partisanship = 3 if q8d==3

replace partisanship = 4 if q8d==1

replace partisanship = 5 if q8c==2

replace partisanship = 6 if q8c==1


* descriptives

summarize man partisanship age education

**** balance checks

* across conditions

mlogit condition partisanship education age, base(0)

* only 4 main conditions (no imbalances)

gen condition1=condition

recode condition1 (4 5=.)

mlogit condition1 partisanship education age, base(0)

* control and two extra conditions (imbalances in partisanship, but partisanship has no effect)

gen condition2 = condition

recode condition2 (1 2 3=.)

mlogit condition2 partisanship education age, base(0)

* between men and women across conditions (imbalances in partisanship and age, not in education)(partisanship has no effect, so is irrelevant)

by condition: ttest partisanship, by(man)

by condition: ttest education, by(man)

by condition: ttest age, by(man)


* manipulation check

tab q11f2_2

gen courtestimate = q11f2_2

recode courtestimate(0 1 2=0) (3=1) (4 5 6 7 9=2) (-1 15 40 53=3) 

label define celabel 3 "Don't Know" 0 "Underestimate" 1 "Correct " 2 "Overestimate"

label values courtestimate celabel

tab condition, gen(condition)

gen all_male = condition2

gen mixed_therm = condition3

gen all_female = condition4

gen question_lift = condition5

gen question_threat = condition6


tab courtestimate condition, col nof

mlogit courtestimate all_male mixed_therm all_female question_lift question_threat man partisanship age, base(1)



** Analysis

sort condition

by condition: reg knowledge2 man age 

reg knowledge2 man age if condition==0

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)

reg knowledge2 man age if condition==1

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)

reg knowledge2 man age if condition==2

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)

reg knowledge2 man age if condition==3

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)

reg knowledge2 man age if condition==4

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)

reg knowledge2 man age if condition==5

prvalue, x(man=0) rest(mean)

prvalue, x(man=1) rest(mean)
